using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

using Volo.Abp.Account.Web;
using Volo.Abp.AspNetCore.MultiTenancy;
using Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite;
using Volo.Abp.AspNetCore.Serilog;
using Volo.Abp.Autofac;
using Volo.Abp.Modularity;
using Volo.Abp.OpenIddict;
using Volo.Abp.Swashbuckle;

using WL.Think.Abp.Modules;

namespace WL.Think.Abp;

[DependsOn(
    typeof(AbpAutofacModule),
    typeof(AbpAspNetCoreMultiTenancyModule),
    typeof(AbpAspNetCoreMvcUiLeptonXLiteThemeModule),
    typeof(AbpAspNetCoreSerilogModule),
    typeof(AbpSwashbuckleModule),
    typeof(AbpAccountWebOpenIddictModule),
    typeof(ThinkAbpCoreModule)
)]
public abstract class ThinkAbpAppHostModule : ThinkStartupModule<ThinkAbpAppHostModule>
{
    protected override void PreConfigureOptions(ServiceConfigurationContext context)
    {
        base.PreConfigureOptions(context);
        if (!context.Services.GetHostingEnvironment().IsDevelopment())
        {
            context.Services.PreConfigure<AbpOpenIddictAspNetCoreOptions>(opts => opts.AddDevelopmentEncryptionAndSigningCertificate = false);
        }
    }
}
